package view;

import java.util.ArrayList;
import javax.swing.JCheckBox;
import javax.swing.table.AbstractTableModel;
import model.Dokument;
import model.PengendaliPenerimaSuratDokumen;

public class TabelDokumen extends AbstractTableModel {

    String columNames[] = {"Nomor Dokumen", "Perihal", "Asal Dokumen", "Penerima Dokumen", "Tanggal Penerima", "Letak Dokumen", "Petugas Penerima", "Keterangan"};
    private ArrayList<Dokument> data;

    public TabelDokumen() {
    }

    public TabelDokumen(ArrayList<Dokument> data) {
        this.data = data;
    }

    @Override
    public int getRowCount() {
        return getData().size();
    }

    @Override
    public int getColumnCount() {
        return columNames.length;
    }

    @Override
    public String getColumnName(int col) {
        return columNames[col];
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
//        PanelTerimaSuratDokumen panel = new PanelTerimaSuratDokumen();
        Dokument temp = getData().get(rowIndex);
       if (columnIndex == 0) {
            return temp.getNomorDokument();
        } else if (columnIndex == 1) {
            return temp.getPerihal();
        } else if (columnIndex == 2) {
            return temp.getAsalDokumen();
        } else if (columnIndex == 3) {
            return temp.getPenerimaDokumen();
        } else if (columnIndex == 4) {
            return temp.getTanggalTerima();
        } else if (columnIndex == 5) {
            return temp.getLetakDokumen();
        } else if (columnIndex == 6) {
            return temp.getPetugasPenerima();
        } else {
            return temp.getKeterangan();
        }
    }

    public ArrayList<Dokument> getData() {
        return data;
    }

    public void setData(ArrayList<Dokument> data) {
        this.data = data;
    }
}
